<template>
  <div class="notice">
    <x-header :left-options="{backText: ''}">通知</x-header>
    <div style="margin-top:10px;border-top:1px solid #f6f6f6">
      <ul>
        <li class="noticeList" v-for="listName in listBox" @click="noticeBtn(listName._id)">
          <span class="listTitle">{{listName.title}}</span>
          <!-- <span>{{listName.created|formatDate}}</span> -->
          <div v-html="listName.content"></div>
        </li>

      </ul>
    </div>
  </div>
  </div>
</template>
<script>
  import { XHeader } from 'vux'
  import http from '../../service/http.js'
  export default {
    data() {
      return {
        listBox: [],
        id: ""
      }
    },
    mounted() {
      this.id = location.hash.split("=")[1];
      this.getList();
    },
    methods: {
      getList() {
        http.get("/home/notices").then((res) => {
          if (res.status == 200) {
            res.data.body.forEach((v) => {
              if (v._id == this.id) {
                this.listBox.push(v);
                return false;
              }
            })
          }
        })
      }
    },
    components: {
      XHeader,
    }
  }
</script>
<style lang="less">
  .notice .vux-header {
    background: #fff;
  }

  .notice .vux-header .vux-header-title {
    line-height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 400;
    color: #000;
  }

  .noticeList {
    border-bottom: 1px solid #f6f6f6;
    height: 40px;
    line-height: 40px;
    padding: 0px 12px;
    position: relative;
    img {
      position: absolute;
      right: 15px;
      top: 10px;
    }
  }

  .notice .vux-header .vux-header-left .left-arrow:before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid #000;
    border-width: 1px 0 0 1px;
    -webkit-transform: rotate(315deg);
    transform: rotate(315deg);
    top: 8px;
    left: 7px;
  }

  .listTitle {
    /* overflow: hidden; */
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 90%;
    display: inline-block;
  }
</style>